<script setup lang="ts">
import BigShotCard from './BigShotCard.vue'
import {useWindowSize}  from '@vueuse/core'
import { getBigShotsPage } from '@/services/consult'

const  {width} = useWindowSize()
const list = ref<BigShotList>()
const loadData = async () => {
  const res = await getBigShotsPage({ current: 1, pageSize: 5 })
  list.value = res.data.rows
}
onMounted(() => loadData())
</script>

<template>
  <div class="follow-bigshot">
    <div class="head">
      <p>关注他们嗯嗯更舒畅</p>
      <a href="javascript:;">查看更多 <i class="van-icon van-icon-arrow" /> </a>
    </div>
    <div class="body">
      <!-- 轮播组件 -->
      <!-- <van-swipe :width="150" :loop="false" :show-indicators="false"> -->
      <van-swipe :width="(150 / 375) * width" :loop="false" :show-indicators="false">
        <van-swipe-item v-for="item in list" :key="item">
          <big-shot-card :item="item" />
        </van-swipe-item>
      </van-swipe>
    </div>
  </div>
</template>
<!-- scrollWidth 滚动的宽度

150 / 375 * deviceWidth   scrollWidth适配值

onMounted() DOM 完毕   获取宽度  window.innerWidth
onunMounted()  取消宽度变化的监听
-->
<style lang="scss" scoped>
.follow-bigshot {
  background-color: var(--pk-bg);
  height: 250px;
  .head {
    display: flex;
    justify-content: space-between;
    height: 45px;
    align-items: center;
    padding: 0 15px;
    font-size: 13px;
    > a {
      color: var(--pk-tip);
    }
  }
  .body {
    width: 100%;
    overflow: hidden;
  }
}
</style>